clear all
set maxvar 5000

cd "/Users/tg2778/Dropbox/0_Reviews_RnRs/072022_JOP_Roads/v3_JOP/Replication - Roads"
log using "4_Log/10_UPData.log"

use "1_Data/upboothdataset_1km.dta", clear

quietly areg changesp treatedpmgsy, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store up1
quietly estadd local sp "All"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if hasroad2011 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store up2
quietly estadd local sp "No road in 2011"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if roadprior2012 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store up3
quietly estadd local sp "No PMGSY road prior"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if hasroad2001 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store up4
quietly estadd local sp "No roads in 2001"
quietly estadd ysumm, me


***********************************************************

quietly areg changesp treatedpmgsy, absorb( ac_acnname ) cluster( ac_acnname )
quietly estimates store F11
quietly estadd local sp "All"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if hasroad2011 == 0, absorb( ac_acnname ) cluster( ac_acnname )
quietly estimates store F12
quietly estadd local sp "No road in 2011"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if roadprior2012 == 0, absorb( ac_acnname ) cluster( ac_acnname )
quietly estimates store F13
quietly estadd local sp "No PMGSY road prior"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if hasroad2001 == 0, absorb( ac_acnname ) cluster( ac_acnname )
quietly estimates store F14
quietly estadd local sp "No roads in 2001"
quietly estadd ysumm, me


**********************************************************

quietly areg changesp_inc treatedpmgsy, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F21
quietly estadd local sp "All"
quietly estadd ysumm, me

quietly areg changesp_inc treatedpmgsy if hasroad2011 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F22
quietly estadd local sp "No road in 2011"
quietly estadd ysumm, me

quietly areg changesp_inc treatedpmgsy if roadprior2012 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F23
quietly estadd local sp "No PMGSY road prior"
quietly estadd ysumm, me

quietly areg changesp_inc treatedpmgsy if hasroad2001 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F24
quietly estadd local sp "No roads in 2001"
quietly estadd ysumm, me

**********************************************************

quietly areg changesp treatedpmgsy if margin <= 15, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F31
quietly estadd local sp "All"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if hasroad2011 == 0 & margin <= 15, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F32
quietly estadd local sp "No road in 2011"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if roadprior2012 == 0 & margin <= 15, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F33
quietly estadd local sp "No PMGSY road prior"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if hasroad2001 == 0 & margin <= 15, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F34
quietly estadd local sp "No roads in 2001"
quietly estadd ysumm, me

**********************************************************

quietly areg changesp treatedpmgsy if acwinner_party == 1, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F41
quietly estadd local sp "All"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if hasroad2011 == 0 & acwinner_party == 1, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F42
quietly estadd local sp "No road in 2011"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if roadprior2012 == 0 & acwinner_party == 1, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F43
quietly estadd local sp "No PMGSY road prior"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if hasroad2001 == 0 & acwinner_party == 1, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F44
quietly estadd local sp "No roads in 2001"
quietly estadd ysumm, me


**********************************************************


quietly areg change_turnout treatedpmgsy, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F51
quietly estadd local sp "All"
quietly estadd ysumm, me

quietly areg change_turnout treatedpmgsy if hasroad2011 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F52
quietly estadd local sp "No road in 2011"
quietly estadd ysumm, me

quietly areg change_turnout treatedpmgsy if roadprior2012 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F53
quietly estadd local sp "No PMGSY road prior"
quietly estadd ysumm, me

quietly areg change_turnout treatedpmgsy if hasroad2001 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F54
quietly estadd local sp "No roads in 2001"
quietly estadd ysumm, me


***********************************************************


quietly areg changebjpvote treatedpmgsy, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F61
quietly estadd local sp "All"
quietly estadd ysumm, me

quietly areg changebjpvote treatedpmgsy if hasroad2011 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F62
quietly estadd local sp "No road in 2011"
quietly estadd ysumm, me

quietly areg changebjpvote treatedpmgsy if roadprior2012 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F63
quietly estadd local sp "No PMGSY road prior"
quietly estadd ysumm, me

quietly areg changebjpvote treatedpmgsy if hasroad2001 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F64
quietly estadd local sp "No roads in 2001"
quietly estadd ysumm, me


****************************************************


use "1_Data/upboothdataset_2km.dta", clear

quietly areg changesp treatedpmgsy, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F71_1
quietly estadd local sp "All"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if hasroad2011 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F71_2
quietly estadd local sp "No road in 2011"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if roadprior2012 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F71_3
quietly estadd local sp "No PMGSY road prior"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if hasroad2001 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F71_4
quietly estadd local sp "No roads in 2001"
quietly estadd ysumm, me


*****************************************************


use "1_Data/upboothdataset_25km.dta", clear


quietly areg changesp treatedpmgsy, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F72_1
quietly estadd local sp "All"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if hasroad2011 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F72_2
quietly estadd local sp "No road in 2011"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if roadprior2012 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F72_3
quietly estadd local sp "No PMGSY road prior"
quietly estadd ysumm, me

quietly areg changesp treatedpmgsy if hasroad2001 == 0, absorb( ac_acnname ) cluster( uniqueboothid )
quietly estimates store F72_4
quietly estadd local sp "No roads in 2001"
quietly estadd ysumm, me


*******Output

*UP Polling Table

esttab up* using "2_Tables/Manuscript_Table3_UPPolling.doc", keep(treatedpmgsy) title(Roads uncorrelated with support for the ruling party at the polling station) scalars("sp Sample" "ymean Mean Δ SP voteshare") replace cells(b(star fmt(3)) se(par fmt(3))) varlabel(treatedpmgsy "PMGSY road") nomtitles addnote("Notes: The unit of analysis is a polling station and the dependent variable is the change in the SP voteshare at that level. The independent variable PMGSY road is 1 if any of the villages within a 1-kilometer radius of the polling station gets a PMGSY project and 0 otherwise. Standard errors are clustered at the polling station level.") rtf substitute("\fs20" "\fs16" "\fs24" "\fs20") collabels(none) varwidth(16) modelwidth(6 10 14 10)


*F.1 Clustering at constituency

esttab F1* using "2_Tables/F1.doc", keep(treatedpmgsy) title(Clustering at constituency level) scalars("sp Sample" "ymean Mean Δ SP voteshare") replace cells(b(star fmt(3)) se(par fmt(3))) varlabel(treatedpmgsy "PMGSY road") nomtitles rtf substitute("\fs20" "\fs16" "\fs24" "\fs20") collabels(none) varwidth(16) modelwidth(6 10 14 10)

*F.2 SP and INC voteshare

esttab F2* using "2_Tables/F2.doc", keep(treatedpmgsy) title(Change in SP and INC voteshare) scalars("sp Sample" "ymean Mean Δ SP+INC voteshare") replace cells(b(star fmt(3)) se(par fmt(3))) varlabel(treatedpmgsy "PMGSY road") nomtitles rtf substitute("\fs20" "\fs16" "\fs24" "\fs20") collabels(none) varwidth(20) modelwidth(6 10 14 10)

*F.3 Competitive challengers

esttab F3* using "2_Tables/F3.doc", keep(treatedpmgsy) title(Polling stations in constituencies where the margin of victory between top two candidates is under 15%) scalars("sp Sample" "ymean Mean Δ SP voteshare") replace cells(b(star fmt(3)) se(par fmt(3))) varlabel(treatedpmgsy "PMGSY road") nomtitles rtf substitute("\fs20" "\fs16" "\fs24" "\fs20") collabels(none) varwidth(16) modelwidth(6 10 14 10)

*F.4 Ruling party constituencies

esttab F4* using "2_Tables/F4.doc", keep(treatedpmgsy) title(Ruling party constituencies) scalars("sp Sample" "ymean Mean Δ SP voteshare") replace cells(b(star fmt(3)) se(par fmt(3))) varlabel(treatedpmgsy "PMGSY road") nomtitles rtf substitute("\fs20" "\fs16" "\fs24" "\fs20") collabels(none) varwidth(16) modelwidth(6 10 14 10)

*F.5 Change in turnout

esttab F5* using "2_Tables/F5.doc", keep(treatedpmgsy) title(Change in turnout) scalars("sp Sample" "ymean Mean Δ turnout") sfmt("%-20s" "%9.3f") replace cells(b(star fmt(3)) se(par fmt(3))) varlabel(treatedpmgsy "PMGSY road") nomtitles rtf substitute("\fs20" "\fs16" "\fs24" "\fs20") collabels(none) varwidth(16) modelwidth(6 10 14 10)

*F.6 BJP voteshare

esttab F6* using "2_Tables/F6.doc", keep(treatedpmgsy) title(Change in BJP voteshare) scalars("sp Sample" "ymean Mean Δ BJP voteshare") sfmt("%-20s" "%9.3f") replace cells(b(star fmt(3)) se(par fmt(3))) varlabel(treatedpmgsy "PMGSY road") nomtitles rtf substitute("\fs20" "\fs16" "\fs24" "\fs20") collabels(none) varwidth(16) modelwidth(6 10 14 10)


*F.7 2 km buffer

esttab F71* using "2_Tables/F7_1.doc", keep(treatedpmgsy) title(Buffer size of 2 KM) scalars("sp Sample" "ymean Mean Δ SP voteshare") replace cells(b(star fmt(3)) se(par fmt(3))) varlabel(treatedpmgsy "PMGSY road") nomtitles rtf substitute("\fs20" "\fs16" "\fs24" "\fs20") collabels(none) varwidth(16) modelwidth(6 10 14 10)

*F.7 2.5 km buffer

esttab F72* using "2_Tables/F7_2.doc", keep(treatedpmgsy) title(Buffer size of 2.5 KM) scalars("sp Sample" "ymean Mean Δ SP voteshare") replace cells(b(star fmt(3)) se(par fmt(3))) varlabel(treatedpmgsy "PMGSY road") nomtitles rtf substitute("\fs20" "\fs16" "\fs24" "\fs20") collabels(none) varwidth(16) modelwidth(6 10 14 10)
log close
